<template>
  <div>
    <div v-if="nowRoleId != 11">
      <Row>
        <Col :lg="12" :md="24">
          <div class="index-button">
            <Button size="large" @click="toUrl(menu.vehicle)">整车产品</Button>
          </div>
        </Col>
        <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button
              size="large"
              @click="
                menuIndex = menu.body;
                menuShow = true;
              "
              >部件产品</Button
            >
          </div>
        </Col>
      </Row>
      <Row>
        <!-- <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button size="large">计算模型</Button>
          </div>
        </Col> -->
        <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button
              size="large"
              @click="
                menuIndex = menu.env;
                menuShow = true;
              "
              >环境工况</Button
            >
          </div>
        </Col>
        <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button size="large" @click="toUrl(menu.easyCompute)"
              >匹配计算</Button
            >
          </div>
        </Col>
      </Row>
      <!-- <Row>
        <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button size="large">数据处理</Button>
          </div>
        </Col>
        <Col :lg="12" :md="24"
          ><div class="index-button">
            <Button size="large">帮助文档</Button>
          </div>
        </Col>
      </Row> -->
    </div>
    <Modal v-model="menuShow" title="菜单选择" footer-hide>
      <div class="modal">
        <Button v-for="item in menuIndex" :key="item" @click="toUrl(item)">{{
          item.title
        }}</Button>
      </div>
    </Modal>
  </div>
</template>

<script>
import ActivePlate from "_c/active-plate/active-plate";
import CountTo from "_c/count-to";
import HomeCard from "./components/card";
import ChartPie from "./components/chart-pie";
import ChartLine from "./components/chart-line";
import ChartGauge from "./components/chart-gauge";
import ChartBar from "./components/chart-bar";
import HomeCircle from "./components/home-circle";
import HomeProgress from "./components/home-progress";
import ChartFunnel from "./components/chart-funnel";

export default {
  name: "Home",
  components: {
    HomeCard,
    ActivePlate,
    CountTo,
    ChartPie,
    ChartFunnel,
    ChartLine,
    HomeCircle,
    ChartGauge,
    ChartBar,
    HomeProgress
  },
  props: {},
  data() {
    return {
      adModal: true,
      nowRoleId: null,
      menuShow: false,
      menuIndex: [],
      menu: {
        vehicle: {
          path: "/vehicle/vehicle-list",
          name: "VehicleList",
          title: "整车"
        },
        body: [
          //  车身列表
          {
            path: "/body/body-list",
            name: "BodyList",
            title: "车身"
          },

          //  发动机列表
          {
            path: "/engine/engine-list",
            name: "EngineList",
            title: "发动机"
          },

          //  变速箱列表
          {
            path: "/gearbox/gearbox-list",
            name: "GearboxList",
            title: "变速箱"
          },
          //  变矩器列表
          {
            path: "/torque-converter/torque-converter-list",
            name: "TorqueConverterList",
            title: "变矩器"
          },
          //  驱动桥列表
          {
            path: "/transaxle/transaxle-list",
            name: "TransaxleList",
            title: "驱动桥"
          },

          //  传动轴列表
          {
            path: "/driveshaft/driveshaft-list",
            name: "DriveshaftList",
            title: "传动轴"
          },

          //  车轮列表
          {
            path: "/wheel/wheel-list",
            name: "WheelList",
            title: "车轮"
          }
        ],
        env: [
          //  环境列表
          {
            path: "/environment/environment-list",
            name: "EnvironmentList",
            title: "环境工况"
          },
          //  气候环境列表
          {
            path: "/atmosphere/atmosphere-list",
            name: "AtmosphereList",
            title: "气候环境"
          },
          {
            path: "/driving-cycle/driving-cycle-list",
            name: "DrivingCycleList",
            title: "行驶工况"
          },
          //  路面列表
          {
            path: "/road/road-list",
            name: "RoadList",
            title: "路面"
          }
        ],
        easyCompute: {
          path: "/easy-compute/index",
          name: "EasyComputeIndex",
          title: "性能简单计算"
        }
      }
    };
  },
  computed: {},
  watch: {},
  filters: {},
  created() {
    this.nowRoleId = this.$store.state.user.userLoginInfo.id;
    console.log(this.nowRoleId);
  },
  mounted() {},
  beforeCreate() {},
  beforeMount() {},
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  activated() {},
  methods: {
    toUrl(item) {
      this.$router.push({
        path: item.path
      });
    }
  }
};
</script>
<style>
.index-button button {
  width: 100%;
}
</style>
<style lang="less">
.index-button {
  padding: 30px;
}
.count-style {
  font-size: 50px;
}
.modal {
  width: 488px;
  button {
    margin: 5px;
  }
}
</style>
